package model;

// Generated 25-Nov-2013 20:54:41 by Hibernate Tools 4.0.0

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;

/**
 * UserAddressHistory generated by hbm2java
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "user_address_history")
public class UserAddressHistory implements java.io.Serializable {

	private UserAddressHistoryId id;
	private User user;
	private Address address;

	public UserAddressHistory() {
	}

	public UserAddressHistory(UserAddressHistoryId id, User user,
			Address address) {
		this.id = id;
		this.user = user;
		this.address = address;
	}

	@EmbeddedId
	@AttributeOverrides({
			@AttributeOverride(name = "userId", column = @Column(name = "user_id", nullable = false)),
			@AttributeOverride(name = "addressId", column = @Column(name = "address_id", nullable = false)),
			@AttributeOverride(name = "dateFrom", column = @Column(name = "date_from", nullable = false, length = 19)) })
	public UserAddressHistoryId getId() {
		return this.id;
	}

	public void setId(UserAddressHistoryId id) {
		this.id = id;
	}

	@ManyToOne
	@LazyCollection(LazyCollectionOption.FALSE)
	@JoinColumn(name = "user_id", nullable = false, insertable = false, updatable = false)
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@ManyToOne
	@LazyCollection(LazyCollectionOption.FALSE)
	@JoinColumn(name = "address_id", nullable = false, insertable = false, updatable = false)
	public Address getAddress() {
		return this.address;
	}

	public void setAddress(Address address) {
		this.address = address;
	}

}
